﻿{% extends "super.html" %}
{% block title %}员工管理{% endblock %}
{% block s1 %}active{% endblock %}
{% block titlehref %}index{% endblock %}
{% block titlename %}全局动态{% endblock %}
{% block subtitlehref %}{% endblock %}
{% block subtitlename %}员工管理{% endblock %}
{% block content %}
<script type="text/javascript" src="static/myjs/release.js"></script>
<section id="main-content">
    <!-- BEGIN WRAPPER  -->
    <section class="wrapper">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        <span class="label label-primary">公告列表</span>
                        <a href="#platform" class="label label-success">发布新内容</a>
                        <span class="tools pull-right">
                           <a href="javascript:;" class="fa fa-chevron-down"></a>
                           <a href="javascript:;" class="fa fa-times"></a>
                           </span>
                    </header>
                    <table class="table table-striped table-advance table-hover">
                        <thead>
                        <tr>
                            <th><i class="fa fa-bullhorn"></i>标题</th>
                            <th><i class="fa fa-question-circle"></i>正文</th>
                            <th><i class="fa fa-bookmark"></i>作者</th>
                            <th><i class="fa fa-bullhorn"></i>状态</th>
                            <th><i class="fa fa-bullhorn"></i>发布日期</th>
                            <th><i class="fa fa-edit"></i>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {%for i in list%}
                        <tr>
                            <td><a href="#">{{i.Title}}</a></td>
                            <td style="width: 40%"><textarea style="width: 100%" rows="3"
                                                             disabled>{{i.Content}}</textarea></td>
                            <td>{{i.Author}}</td>
                            <td><span class="label label-info label-mini">
                                {%if i.Status == 1%}
                                已发布
                                {%else%}
                                已过期
                                {%endif%}
                            </span></td>
                            <td style="width: 15%"><span class=" label label-info label-mini">{{i.Create_time}}</span>
                            </td>
                            <td>
                                <button onclick="ChangeStatus('{{i.Id}}','{{i.Status}}')" class="btn
                                 {%if i.Status != 1%}
                                btn-success
                                {%else%}
                                btn-danger
                                {%endif%}
                                btn-xs">
                                    {%if i.Status != 1%}
                                    发布
                                    {%else%}
                                    撤销
                                    {%endif%}
                                </button>
                                <button onclick="DeleteNews({{i.Id}})" class="btn btn-success btn-xs"><i class="fa fa-times"></i></button>
                                <button onclick="loadnews({{i.Id}})" data-toggle="modal" data-target="#myModal" class="btn btn-primary btn-xs"><i
                                        class="fa fa-pencil"></i></button>
                            </td>
                        </tr>
                        {%endfor%}
                        </tbody>
                    </table>
                </section>
            </div>
        </div>


        <div class="row" id="platform">
            <form id="createnews" action="news" method="post" onsubmit="return Check()">
                <div class="col-lg-12">
                    <section class="panel">
                        <header class="panel-heading">
                            <span class="btn btn-success" disabled="">编辑发布的内容</span>
                            <span class="tools pull-right">
                            <button id="release" type="button" class="btn btn-success">发布</button>
                           </span>
                        </header>
                        <div class="panel-body">
                            <input name="option" value="CCC" hidden>
	                        <input name="status" value="1" hidden>
	                        <input name="type" value="{{type}}" hidden>
	                        <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">标题</label>
                                <div class="col-sm-10">
                                    <input id="title" name="title" type="text" class="form-control">
                                    <span class="help-block">发布前须知:标题不能为空</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">正文</label>
                                <div class="col-sm-10">
                                    <textarea id="content" name="content" type="text" rows="20"
                                              class="form-control"></textarea>
                                    <span class="help-block">发布前须知:正文不能为空</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">作者</label>
                                <div class="col-sm-10">
                                    <input id="author" name="author" type="text" class="form-control round-input"
                                           value="{{author}}">
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
            </form>
        </div>

        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            编辑发布内容
                        </h4>
                    </div>
                    <div class="modal-body">
                        <form id="updatenews" action="news" method="post" onsubmit="return Check()">
                            <div class="panel-body">
                                <input id="uid" name="id" hidden>
                                <input name="option" value="UUU" hidden>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">标题</label>
                                    <div class="col-sm-10">
                                        <input id="utitle" name="title" type="text" class="form-control">
                                        <span class="help-block">发布前须知:标题不能为空</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">正文</label>
                                    <div class="col-sm-10">
                                    <textarea id="ucontent" name="content" type="text" rows="10"
                                              class="form-control"></textarea>
                                        <span class="help-block">发布前须知:正文不能为空</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-2 control-label">作者</label>
                                    <div class="col-sm-10">
                                        <input id="uauthor" name="author" type="text" class="form-control round-input"
                                               value="{{author}}">
                                    </div>
                                </div>
                            </div>
                        </form>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                        <button id="update" type="button" class="btn btn-primary">
                            提交更改
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </section>
</section>

{% endblock%}